--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Commit f80230ffe72a78dd2f2e7ac33918321000a081b3
Parents : 36926d8
Author : Mark Qvist <mark@unsigned.io>
Date : 2022-01-10T19:33:47+01:00
Work on ESP32 compatibility
Changes
3 files changed, 19 insertions(+), 9 deletions(-)
Diff
diff --git a/Config.h b/Config.h
index ca0a609..312db43 100644
--- a/Config.h
+++ b/Config.h
@@ -19,15 +19,12 @@
#if defined(__AVR_ATmega1284P__)
#define PLATFORM PLATFORM_AVR
#define MCU_VARIANT MCU_1284P
- #warning "Firmware is being compiled for atmega1284p based boards"
#elif defined(__AVR_ATmega2560__)
#define PLATFORM PLATFORM_AVR
#define MCU_VARIANT MCU_2560
- #warning "Firmware is being compiled for atmega2560 based boards"
#elif defined(ESP32)
#define PLATFORM PLATFORM_ESP32
#define MCU_VARIANT MCU_ESP32
- #warning "Firmware is being compiled for ESP32 based boards"
#else
#error "The firmware cannot be compiled for the selected MCU variant"
#endif
@@ -48,6 +45,8 @@
const int pin_led_rx = 12;
const int pin_led_tx = 13;
+ const long serial_baudrate = 115200;
+
#define CONFIG_UART_BUFFER_SIZE 6144
#define CONFIG_QUEUE_SIZE 6144
#define CONFIG_QUEUE_MAX_LENGTH 250
@@ -62,6 +61,8 @@
const int pin_led_rx = 12;
const int pin_led_tx = 13;
+ const long serial_baudrate = 115200;
+
#define CONFIG_UART_BUFFER_SIZE 2048
#define CONFIG_QUEUE_SIZE 2048
#define CONFIG_QUEUE_MAX_LENGTH 80
@@ -76,6 +77,8 @@
const int pin_led_rx = 2;
const int pin_led_tx = 4;
+ const long serial_baudrate = 921600;
+
#define CONFIG_UART_BUFFER_SIZE 6144
#define CONFIG_QUEUE_SIZE 6144
#define CONFIG_QUEUE_MAX_LENGTH 250
@@ -87,7 +90,6 @@
#define eeprom_addr(a) (a+EEPROM_OFFSET)
// MCU independent configuration parameters
- const long serial_baudrate = 115200;
const int lora_rx_turnaround_ms = 50;
// SX1276 RSSI offset to get dBm value from
diff --git a/RNode_Firmware.ino b/RNode_Firmware.ino
index 1c199b4..c5a5f18 100644
--- a/RNode_Firmware.ino
+++ b/RNode_Firmware.ino
@@ -25,7 +25,8 @@ void setup() {
#if MCU_VARIANT == MCU_ESP32
delay(500);
EEPROM.begin(EEPROM_SIZE);
- Serial.setRxBufferSize(CONFIG_UART_BUFFER_SIZE);
+ // TODO: Check this
+ //Serial.setRxBufferSize(CONFIG_UART_BUFFER_SIZE);
#endif
// Seed the PRNG
@@ -710,8 +711,11 @@ void serial_poll() {
serial_polling = false;
}
-
-#define MAX_CYCLES 20
+#if MCU_VARIANT != MCU_ESP32
+ #define MAX_CYCLES 20
+#else
+ #define MAX_CYCLES 1
+#endif
void buffer_serial() {
if (!serial_buffering) {
serial_buffering = true;
diff --git a/Utilities.h b/Utilities.h
index 5d7ce58..ebc09b4 100644
--- a/Utilities.h
+++ b/Utilities.h
@@ -131,7 +131,7 @@ unsigned long led_standby_ticks = 0;
uint8_t led_notready_value = led_notready_min;
int8_t led_notready_direction = 0;
unsigned long led_notready_ticks = 0;
- unsigned long led_standby_wait = 4000;
+ unsigned long led_standby_wait = 1768;
unsigned long led_notready_wait = 150;
#endif
uint8_t led_standby_value = led_standby_min;
@@ -163,7 +163,11 @@ int8_t led_standby_direction = 0;
led_standby_direction = -1;
}
led_standby_value += led_standby_direction;
- analogWrite(pin_led_tx, led_standby_value);
+ if (led_standby_value > 253) {
+ led_tx_on();
+ } else {
+ led_tx_off();
+ }
led_rx_off();
}
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────